{% extends 'classroom/content-layout.html.twig' %}
{% block title %}{{ parent() }}{% endblock %}
{% block description %}{{ classroomDescription|default('')|plain_text(100) }}{% endblock %}
{% set nav = 'course' %}
{% do script(['app/js/classroom/course-list/index.js'])%}

{% block main %}

  {% if isCourseMember|default(false) %}
    {% set courseShowPath = 'my_course_show' %}
  {% else %}
    {% set courseShowPath = 'course_show' %}
  {% endif %}

  <div class="class-course-list">
    {% for course in courses %}
      <div class="course-item">
        <div class="media">
          <a class="media-left" href="{{ path(courseShowPath, {id:course.id}) }}">
            {{ lazy_img(filepath(course_cover(course, 'middle'), 'course.png'), '', '') }}
          </a>
          <div class="media-body">
            <div class="title">
              <a href="{{ path(courseShowPath, {id:course.id}) }}">
                {% if course.courseNum|default(1) > 1 %}
                  {{ course.courseSet.title ~ ' - ' ~ course.title }}
                {% else %}
                  {{ course.courseSet.title|sub_text(56) }}
                {% endif %}
              </a>
            </div>
            <div class="my-course-item__progress cd-clearfix">
              <div class="cd-progress cd-progress-sm" style="position: relative;margin-bottom: 0;">
                <span class="my-course-item__progress__text">{{ 'course.members_manage.official_student.progress'|trans }}</span>
                <div class="progress-bar" style="width: 70%;float: none;margin-left: 8px;">
                  <div class="progress-outer">
                    <div class="progress-inner" style="width: {{ percent(courseMembers[course.id].learnedCompulsoryTaskNum, course.compulsoryTaskNum) }};height:10px"></div>
                  </div>
                </div>
                <div class="progress-text" style="width: 40px;margin-bottom: 4px;">{{ percent(courseMembers[course.id].learnedCompulsoryTaskNum, course.compulsoryTaskNum) }}</div>
              </div>
            </div>
            <div class="hidden-xs class-course-price">
                {{ 'classroom.origin_price'|trans }}：
                {% include 'course/widgets/price.html.twig' with {courseSet: course.courseSet, shows:'originPrice'} %}
            </div>
            {% if setting('goods_setting.show_review', '1') == 1 %}
              <div class="class-course-score">
                {{ web_macro.star(course.rating) }}
              </div>
            {% else %}
              <div class="pbm"></div>
            {% endif %}
            <span class="course-show">
              <i class="es-icon es-icon-keyboardarrowdown" data-lesson-url="{{ path('classrom_course_tasks_list', {courseId:course.id, classroomId:classroom.id}) }}"></i>
            </span>
          </div>
        </div>

      </div>
    {% endfor %}

  </div>
{% endblock %}
